<template>
    <el-dialog v-model="dialoVisible" :title="props.title" :width="props.width">
        <slot></slot>
        <template #footer>
            <div class="dialog-footer">
                <el-button @click="onCancel">取消</el-button>
                <el-button type="primary" @click="onSubmit"> 确定 </el-button>
            </div>
        </template>
    </el-dialog>
</template>

<script setup name="OADialog">
import { defineModel, defineProps, defineEmits } from 'vue';

let dialoVisible = defineModel({ required:true});

let props = defineProps({
    title:{
        type:String,
        default:''
    },
    width:{
        type:String,
        default:'500px'
    }
});

const emits = defineEmits(['cancel','submit']);

const onCancel = () => {
    dialoVisible.value = false;
    emits('cancel');
}

const onSubmit = () => {
    emits('submit');
}

</script>

<style scoped></style>